package base.core.security.pass;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

import lombok.SneakyThrows;

/**
 * @Description 拦截器配置,不做任何拦截,全部放开
 * @Author Pengwei
 * @CreatDate 2022/1/10 17:05
 */
@Primary
@Configuration
@ConditionalOnMissingBean(WebSecurityConfigurerAdapter.class)
public class PassWebSecurityConfigurer extends WebSecurityConfigurerAdapter {

    @Override
    @SneakyThrows
    protected void configure(HttpSecurity http) {
        http.authorizeRequests()
                .antMatchers("/**").permitAll()
                .and().csrf().disable()
                .headers().frameOptions().disable()
                ;
    }
}
